package launcher;

import java.io.File;

import document.DocumentLibrary;
import document.InvertedIndex;

import query.QueryLibrary;


/**
 * Launcher for prototyping
 * @author daniel
 *
 */
public class ProtoLauncher {
	
	private static final String DOC_PATH =  "TIME" + File.separator + "Docs";
	private static final String QUERY_PATH =  "TIME" + File.separator + "Queries";
	
	public static void main(String[] args) {
		DocumentLibrary library = new DocumentLibrary();
		library.initializeFrom(DOC_PATH);
		//library.print();
		InvertedIndex index = new InvertedIndex();
		index.indexLibrary(library);
		
		// Just for testing
//		OrOperand o1 = new OrOperand();
//		OrOperand o2 = new OrOperand();
//		OrOperand o3 = new OrOperand();
//		OrOperand o4 = new OrOperand();
//		
//		Term t1 = new Term("COUNTRY");
//		Term t2 = new Term("NEW");
//		Term t3 = new Term("JOIN");
//		Term t4 = new Term("UNITED");
//		Term t5 = new Term("NATIONS");
//		
//		o4.putRightOperand(t5);
//		o4.putLeftOperand(t4);
//		o3.putRightOperand(o4);
//		o3.putLeftOperand(t3);
//		o2.putRightOperand(o3);
//		o2.putLeftOperand(t2);
//		o1.putRightOperand(o2);
//		o1.putLeftOperand(t1);
//		
//		
//		AndOperand v1 = new AndOperand();
//		AndOperand v2 = new AndOperand();
		

		
		QueryLibrary queries = new QueryLibrary();
		queries.initializeFrom(QUERY_PATH);
		queries.processAll(index);
		
		System.out.println("Static statistics:\n\n");
		System.out.println(index.getStatistics(library.getNumbeOfDocuments()));
		
		
	}

}
